Generally, databases include large sets of records (informational items). The records are often arranged as rows of a table. Typically, a primitive that is defined by the database manufacturer describes the manner in which records are retrieved from the database. For example, DB2 allows for the retrieval of a first specified number of rows from the database. An Oracle database allows for the retrieval of a page of rows (e.g., rows M through N). Often the user or application requesting the records from the database does not have access to all of the returned records due to security restrictions. In order to retrieve a desired number of accessible records, the database is accessed repeatedly.
One known method of retrieving the desired number of records is to retrieve a first specified number of records from the database, discard the irrelevant records, retrieve more records from the database continuing with the first record that was not previously retrieved, and repeating this operation until the desired number of relevant records is reached.
The above method is undesirable in many instances. In databases such as DB2 and Oracle, the cost of retrieving records from the database can be approximated as the product of the fixed high cost of connecting to the database and the number of repeated connections to the database combined with the product of the fixed cost of retrieving one record from the database and the total number of retrieved records. For a reasonably low desired number of records (e.g., records associated with a screen display), the connection costs dominates the other costs. Thus it is desirable to minimize the number of connections to the database.